package jannex.label;

class SingletonLabelList extends LabelList {

    private final String label;

    public SingletonLabelList(String label) {
        this.label = label;
    }

    @Override
    public String get(int index) {
        return label;
    }

    @Override
    public int size() {
        return 1;
    }

    @Override
    public int indexOf(Object o) {
        if (o == null || !(o instanceof String)) {
            return -1;
        }
        return label.equalsIgnoreCase(o.toString()) ? 0 : -1;
    }

    @Override
    public String[] toArray() {
        return new String[]{label};
    }
}
